<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace AlibabaCloud\Client\Signature;

class ShaHmac256WithRsaSignature extends Signature implements SignatureInterface
{
    public function getMethod()
    {
        return "SHA256withRSA";
    }
    public function getType()
    {
        return "PRIVATEKEY";
    }
    public function getVersion()
    {
        return "1.0";
    }
    public function sign($string, $privateKey)
    {
        $binarySignature = "";
        try {
            openssl_sign($string, $binarySignature, $privateKey, OPENSSL_ALGO_SHA256);
        } catch (\Exception $exception) {
            throw new \AlibabaCloud\Client\Exception\ClientException($exception->getMessage(), \AlibabaCloud\Client\SDK::INVALID_CREDENTIAL);
        }
        return base64_encode($binarySignature);
    }
}

?>